<template>
  <div class="rights">
    <el-card>
      <el-table :data="tableData" style="width: 100%">
        <el-table-column type="index" label="ID"> </el-table-column>
        <el-table-column prop="authName" label="权限名称"></el-table-column>
        <el-table-column prop="path" label="路径"> </el-table-column>
        <el-table-column prop="level" label="权限等级">
          <template slot-scope="scope">
            <el-tag :type="levelArr[scope.row.level].type">{{
              levelArr[scope.row.level].name
            }}</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      tableData: [],
      levelArr: [
        {
          name: "一级",
          type: "",
        },

        {
          name: "二级",
          type: "success",
        },

        {
          name: "三级",
          type: "warning",
        },
      ],
    };
  },
  mounted() {
    this.$http("rights/list").then((res) => {
      this.tableData = res.data.data;
    });
  },
};
</script>

<style></style>
